]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginScreen: Add support for 'disable-restart-buttons'
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 16 Oct 2012 19:32:05 +0000 (21:32 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 16 Oct 2012 20:57:37 +0000 (22:57 +0200)
GDM's GSettings schema contains a 'disable-restart-buttons' key
that currently is only supported by the fallback greeter.
Implement support in the shell greeter as well.

https://bugzilla.gnome.org/show_bug.cgi?id=686247

js/gdm/powerMenu.js

index b57eec5cb6018519807d93c7438d9ceaef324e80..bf545c13b68063da6efdab2400aaed31981274c3 100644 (file)
  * 02111-1307, USA.
  */
 
+const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const UPowerGlib = imports.gi.UPowerGlib;
 
 const LoginManager = imports.misc.loginManager;
 
+const GdmUtil = imports.gdm.util;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
@@ -37,6 +39,10 @@ const PowerMenuButton = new Lang.Class({
 
         this._loginManager = LoginManager.getLoginManager();
 
+        this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
+        this._settings.connect('changed::disable-restart-buttons',
+                               Lang.bind(this, this._updateVisibility));
+
         this._createSubMenu();
 
         this._upClient.connect('notify::can-suspend',
@@ -58,7 +64,7 @@ const PowerMenuButton = new Lang.Class({
 
     _updateVisibility: function() {
         let shouldBeVisible = (this._haveSuspend || this._haveShutdown || this._haveRestart);
-        this.actor.visible = shouldBeVisible;
+        this.actor.visible = shouldBeVisible && !this._settings.get_boolean('disable-restart-buttons');
     },
 
     _updateHaveShutdown: function() {